//
//  SSBaseTableViewController.swift
//  weibo
//
//  Created by 邵帅 on 16/6/23.
//  Copyright © 2016年 groupNineObject. All rights reserved.
//

import UIKit

class SSBaseTableViewController: UITableViewController {
    
    let registerView = SSRegisterView()
    
    let isLogin : Bool = SSOauthModel.shareInstance.isLogin
 
    
    override func loadView() {
        
        if isLogin {
            
            super.loadView()
            
            
        }else {
            
            view = registerView
            registerView.startAnimation()
            
            // 登录，注册回调
            registerView.loginClosure = {
                printLog("登录界面跳转")
                
                
            }
            registerView.registerClosure = {
                printLog("注册界面跳转")
                
                self.leftBtnClick()
            }
            
            setupNav()
        }
        
    }
    
    func setupNav() {
        
        self.navigationItem.leftBarButtonItem = UIBarButtonItem(title: "注册", style: .Plain, target: self, action: #selector(SSBaseTableViewController.leftBtnClick))
        
        self.navigationItem.rightBarButtonItem = UIBarButtonItem(title: "登录", style: .Plain, target: self, action: #selector(SSBaseTableViewController.rightBtnClick))
        
    }
    
    func leftBtnClick() {
        
        printLog("注册界面跳转")
        
        let oauth = SSOauthViewController()
        
        let nav = UINavigationController(rootViewController: oauth)
        
        presentViewController(nav, animated: true, completion: nil)
    }
    
    func rightBtnClick() {
        
        printLog("登录界面跳转")
    }
    

    override func viewDidLoad() {
        super.viewDidLoad()
        
    }
    


}
